package com.example.star.mapper;

import com.example.star.entity.Star;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StarMapper {

    @Insert("INSERT INTO stars (username,imageResource, name, age, birthDate, birthPlace, nationality, actingExperience, representativeWorks, profession) " +
            "VALUES (#{userName},#{imageResource}, #{name}, #{age}, #{birthDate}, #{birthPlace}, #{nationality}, #{actingExperience}, #{representativeWorks}, #{profession})")
    void insertStar(Star star);

    @Select("SELECT * FROM stars")
    List<Star> getAllStars();

    @Delete("DELETE FROM stars WHERE id = #{id}")
    void deleteStar(int id);

    @Select("SELECT * FROM stars LIMIT #{offset}, #{limit}")
    List<Star> getStarsByPage(@Param("offset") int offset, @Param("limit") int limit);
    @Select("SELECT COUNT(*) FROM stars")
    int getTotalStars();

}